/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.webos.java.jabber.tree;

import java.util.Comparator;
import org.webos.java.root.Log;

/**
 *
 * @author Kostya
 */
public class UserComparator implements Comparator<UserItem>{

    public int compare(UserItem o1, UserItem o2) {
        if(o1.status==o2.status){
            int comp = o1.userName.compareToIgnoreCase(o2.userName);
    //        Log.debug(this, "Compare: "+o1.userName+" and "+o2.userName+" = "+comp);
            return comp;
        }
        if(o1.status==0)
            return 1;
        if(o2.status==0)
            return -1;
        return o1.status<o2.status?-1:1;
    }

}
